package com.cssw.fyzb.core.dao.acct;

import com.cssw.fyzb.core.model.dodb.AdapayAcct;
import com.cssw.fyzb.core.model.dodb.RnbExchangeFDef;
import com.ydn.dbframe.plugin.activerecord.Page;
import com.ydn.dbframe.plugin.activerecord.parse.SqlParse;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Author yangyiqun
 * @create 2020-12-21 16:04
 */
@Repository
public class AdapayAcctDaoImpl implements AdapayAcctDao {

    @Override
    public AdapayAcct getById(Long userId) {
        return AdapayAcct.dao.findById(userId);
    }

    @Override
    public void add(Long userId, String gender, String nickName, String telNo, String userName, String certType, String certId, String disabled) {
        AdapayAcct adapayAcct = new AdapayAcct();
        adapayAcct.setUserId(userId);
        adapayAcct.setGender(gender);
        adapayAcct.setNickname(nickName);
        adapayAcct.setTelNo(telNo);
        adapayAcct.setUserName(userName);
        adapayAcct.setCertType(certType);
        adapayAcct.setCertId(certId);
        adapayAcct.setDisabled(disabled);
        adapayAcct.setCreateTime(new Date());
        adapayAcct.save();
    }

    @Override
    public void add(Long userId, String gender, String nickName, String telNo, String userName, String certType, String certId,
                    String acctId, String bankCode, String bankName, String cardId, String bankAcctType, String provCode, String areaCode, String disabled) {
        AdapayAcct adapayAcct = new AdapayAcct();
        adapayAcct.setUserId(userId);
        adapayAcct.setGender(gender);
        adapayAcct.setNickname(nickName);
        adapayAcct.setTelNo(telNo);
        adapayAcct.setUserName(userName);
        adapayAcct.setCertType(certType);
        adapayAcct.setCertId(certId);
        adapayAcct.setBankCode(bankCode);
        adapayAcct.setBankName(bankName);
        adapayAcct.setCardId(cardId);
        adapayAcct.setBankAcctType(bankAcctType);
        adapayAcct.setProvCode(provCode);
        adapayAcct.setAreaCode(areaCode);
        adapayAcct.setDisabled(disabled);
        adapayAcct.setCreateTime(new Date());
        adapayAcct.save();
    }

    @Override
    public void updateSettleAcct(Long userId, String settleAcctId, String bankCode, String bankName, String cardId, String bankAcctType, String provCode, String areaCode) {
        AdapayAcct adapayAcct = new AdapayAcct();
        adapayAcct.setUserId(userId);
        adapayAcct.setBankCode(bankCode);
        adapayAcct.setBankName(bankName);
        adapayAcct.setCardId(cardId);
        adapayAcct.setBankAcctType(bankAcctType);
        adapayAcct.setProvCode(provCode);
        adapayAcct.setAreaCode(areaCode);
        adapayAcct.setSettleAcctId(settleAcctId);
        adapayAcct.update();
    }

    @Override
    public void deleteSettleAcct(Long userId) {
        AdapayAcct adapayAcct = new AdapayAcct();
        adapayAcct.setUserId(userId);
        adapayAcct.setBankCode("");
        adapayAcct.setBankName("");
        adapayAcct.setCardId("");
        adapayAcct.setBankAcctType("");
        adapayAcct.setProvCode("");
        adapayAcct.setAreaCode("");
        adapayAcct.setSettleAcctId("");
        adapayAcct.update();
    }

    @Override
    public void update(AdapayAcct adapayAcct) {
        adapayAcct.update();
    }
}
